{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import *\n",
    "import operator\n",
    "from os import listdir\n",
    "from collections import Counter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "def createDataSet():  #创建数据集和标签\n",
    "    group = array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])\n",
    "    labels = ['A','A','B','B']\n",
    "    return group,labels"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "def classify0(inx,dataSet,labels,k):\n",
    "    dataSetSize = dataSet.shape[0]\n",
    "    diffMat = tile(inx,(dataSetSize,1)) - dataSet\n",
    "    sqDiffMat = diffMat ** 2\n",
    "    sqDistances = sqDiffMat.sum(axis=1)\n",
    "    distances = sqDistances ** 0.5\n",
    "    sortedDistIndices = distances.argsort()\n",
    "    classCount = {}\n",
    "    for i in range(k):\n",
    "        voteIlabel = labels[sortedDistIndices[i]]\n",
    "        classCount[voteIlabel] = classCount.get(voteIlabel,0)+1\n",
    "    sortedClassCount = sorted(classCount.items(),key=operator.itemgetter(1),reverse=True)\n",
    "    return sortedClassCount[0][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "def file2matrix(filename):  #将文件数据转换成矩阵形式\n",
    "    fr = open(filename)     #打开文件\n",
    "    numberOfLines = len(fr.readlines())  #计算文件行数\n",
    "    returnMat = zeros((numberOfLines,3)) #初始化一个全0矩阵\n",
    "    classLabelVector = []\n",
    "    fr = open(filename)\n",
    "    index = 0\n",
    "    for line in fr.readlines():  #逐行读取数据\n",
    "        line = line.strip()   #去掉空格符\n",
    "        listFromLine = line.split('\\t') #以'\\t'切割字符串\n",
    "        returnMat[index,:] = listFromLine[0:3]  #每列的属性数据\n",
    "        classLabelVector.append(int(listFromLine[-1]))  #将最后一个类别数据追加到\n",
    "        index += 1\n",
    "    return returnMat,classLabelVector"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "def autoNorm(dataSet):  #数据归一化处理\n",
    "    minVals = dataSet.min(0)  #计算属性最小值\n",
    "    maxVals = dataSet.max(0)#计算属性最大值\n",
    "    rages = maxVals - minVals  #计算最大最小的差\n",
    "    normDataSet = zeros(shape(dataSet))\n",
    "    m = dataSet.shape[0]\n",
    "    normDataSet = dataSet - tile(minVals,(m,1))\n",
    "    normDataSet = normDataSet / tile(ranges,(m,1))\n",
    "    return normDataSet,ranges,minVals"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "def datingClassTest():  #约会网站数据测试\n",
    "    hoRatio = 0.1\n",
    "    datingDataMat,datingLabels = file2matrix('datingTestSet2.txt')  #读取数据\n",
    "    normMat,ranges,minVals = autoNorm(datingDataMat)  #归一化\n",
    "    m = normMat.shape[0]\n",
    "    numTestVecs = int(m * hoRatio)  #测试样本数量\n",
    "    print('numTestVecs=',numTestVecs)\n",
    "    errorCount = 0.0\n",
    "    for i in range(numTestVecs):\n",
    "        classifierResult = classify0(normMat[i,:],normMat[numTestVecs:m,:],datingLabels[numTestVecs:m],3)\n",
    "        print(\"the classifier came back with:%d,the real answer is:%d\"%(classifierResult,datingLabels[i]))\n",
    "        if(classifierResult != datingLabels[i]):\n",
    "            errorCount += 1.0\n",
    "    print(\"the total error rate is : %f\"%(errorCount / float(numTestVecs)))\n",
    "    print(errorCount)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "def img2vector(filename):  #将图片数据转为矩阵\n",
    "    returnVect = zeros((1,1024))\n",
    "    fr = open(filename)\n",
    "    for i in range(32):\n",
    "        lineStr = fr.readline()\n",
    "        for j in range(32):\n",
    "            returnVect[0,32*i+j] = int(lineStr[j])\n",
    "    return returnVect"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "def handwritingClassTest():\n",
    "    # 1. 导入数据\n",
    "    hwLabels = []\n",
    "    trainingFileList = listdir('digits/trainingDigits')  # load the training set\n",
    "    m = len(trainingFileList)\n",
    "    trainingMat = zeros((m, 1024))\n",
    "    # hwLabels存储0～9对应的index位置， trainingMat存放的每个位置对应的图片向量\n",
    "    for i in range(m):\n",
    "        fileNameStr = trainingFileList[i]\n",
    "        fileStr = fileNameStr.split('.')[0]  # take off .txt\n",
    "        classNumStr = int(fileStr.split('_')[0])\n",
    "        hwLabels.append(classNumStr)\n",
    "        # 将 32*32的矩阵->1*1024的矩阵\n",
    "        trainingMat[i, :] = img2vector('digits/trainingDigits/%s' % fileNameStr)\n",
    "\n",
    "    # 2. 导入测试数据\n",
    "    testFileList = listdir('digits/testDigits')  # iterate through the test set\n",
    "    errorCount = 0.0\n",
    "    mTest = len(testFileList)\n",
    "    for i in range(mTest):\n",
    "        fileNameStr = testFileList[i]\n",
    "        fileStr = fileNameStr.split('.')[0]  # take off .txt\n",
    "        classNumStr = int(fileStr.split('_')[0])\n",
    "        vectorUnderTest = img2vector('digits/testDigits/%s' % fileNameStr)\n",
    "        classifierResult = classify0(vectorUnderTest, trainingMat, hwLabels, 3)\n",
    "        print(\"the classifier came back with: %d, the real answer is: %d\" % (classifierResult, classNumStr))\n",
    "        if (classifierResult != classNumStr): errorCount += 1.0\n",
    "    print(\"\\nthe total number of errors is: %d\" % errorCount)\n",
    "    print(\"\\nthe total error rate is: %f\" % (errorCount / float(mTest)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numTestVecs= 100\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:3,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:3\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:3,the real answer is:3\n",
      "the classifier came back with:2,the real answer is:2\n",
      "the classifier came back with:1,the real answer is:1\n",
      "the classifier came back with:3,the real answer is:1\n",
      "the total error rate is : 0.050000\n",
      "5.0\n"
     ]
    }
   ],
   "source": [
    "datingClassTest()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 0, the real answer is: 0\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 7, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 1, the real answer is: 1\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 2, the real answer is: 2\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 9, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 3, the real answer is: 3\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 4, the real answer is: 4\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 3, the real answer is: 5\n",
      "the classifier came back with: 6, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 5, the real answer is: 5\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 6, the real answer is: 6\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 7, the real answer is: 7\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 6, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 3, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 1, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 1, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 8, the real answer is: 8\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 1, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 7, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "the classifier came back with: 9, the real answer is: 9\n",
      "\n",
      "the total number of errors is: 10\n",
      "\n",
      "the total error rate is: 0.010571\n"
     ]
    }
   ],
   "source": [
    "handwritingClassTest()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
